Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove vue-template-compiler when useless #2339

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/ComponentFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ let webpackMerge = require('webpack-merge');

let components = [
'JavaScript',
'Vue',
'Preact',
'React',
'Coffee',
Expand Down
26 changes: 1 addition & 25 deletions src/components/JavaScript.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
let glob = require('glob');
let Assert = require('../Assert');
let Vue = require('./Vue');

class JavaScript {
constructor() {
this.vue = new Vue();
this.toCompile = [];

JavaScript.vueWebpackConfigApplied = false;
}

/**
Expand All @@ -16,14 +12,7 @@ class JavaScript {
name() {
let name = this.constructor.name.toLowerCase();

return name === 'javascript' ? ['js', 'vue'] : name;
}

/**
* Required dependencies for the component.
*/
dependencies() {
return this.vue.dependencies();
return name === 'javascript' ? 'js' : name;
}

/**
Expand Down Expand Up @@ -79,19 +68,6 @@ class JavaScript {
}
]);
}

/**
* Override the generated webpack configuration.
*
* @param {Object} webpackConfig
*/
webpackConfig(webpackConfig) {
if (!JavaScript.vueWebpackConfigApplied) {
this.vue.webpackConfig(webpackConfig);
}

JavaScript.vueWebpackConfigApplied = true;
}
}

module.exports = JavaScript;
2 changes: 0 additions & 2 deletions src/components/TypeScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ class TypeScript extends JavaScript {
* @param {Object} config
*/
webpackConfig(config) {
super.webpackConfig(config);

config.resolve.extensions.push('.ts', '.tsx');
config.resolve.alias['vue$'] = 'vue/dist/vue.esm.js';
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/Vue.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
let { VueLoaderPlugin } = require('vue-loader');
let { Chunks } = require('../Chunks');
let JavaScript = require('./JavaScript');

class Vue {
class Vue extends JavaScript {
constructor() {
super();
this.chunks = Chunks.instance();
}

Expand Down
6 changes: 3 additions & 3 deletions test/features/extraction.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mix from './helpers/setup';

test.serial.cb('JS compilation with vendor extraction config', t => {
mix.js(
mix.vue(
'test/fixtures/fake-app/resources/assets/extract/app.js',
'js'
).extract(['vue'], 'js/libraries.js');
Expand Down Expand Up @@ -40,7 +40,7 @@ test.serial.cb(
test.serial.cb(
'JS compilation with vendor extraction with default config',
t => {
mix.js(
mix.vue(
'test/fixtures/fake-app/resources/assets/extract/app.js',
'js'
).extract(['vue']);
Expand All @@ -60,7 +60,7 @@ test.serial.cb(
);

test.serial.cb('JS compilation with total vendor extraction', t => {
mix.js(
mix.vue(
'test/fixtures/fake-app/resources/assets/extract/app.js',
'js'
).extract();
Expand Down
4 changes: 2 additions & 2 deletions test/features/mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test.serial.cb('the kitchen sink', t => {
});

test.serial.cb('async chunk splitting works', t => {
mix.js('test/fixtures/fake-app/resources/assets/extract/app.js', 'js')
mix.vue('test/fixtures/fake-app/resources/assets/extract/app.js', 'js')
.extract(['vue', 'lodash', 'core-js'])
.options({
babelConfig: {
Expand All @@ -70,7 +70,7 @@ test.serial.cb('async chunk splitting works', t => {
});

test.serial.cb('multiple extractions work', t => {
mix.js('test/fixtures/fake-app/resources/assets/extract/app.js', 'js')
mix.vue('test/fixtures/fake-app/resources/assets/extract/app.js', 'js')
.extract(['vue', 'lodash'], 'js/vendor-vue-lodash.js')
.extract(['core-js'], 'js/vendor-core-js.js')
.options({
Expand Down
2 changes: 1 addition & 1 deletion test/features/vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ test.serial.cb.only('it supports global Vue styles for sass', t => {
less: ['test/fixtures/fake-app/resources/assets/less/global.less'],
stylus: ['test/fixtures/fake-app/resources/assets/stylus/global.styl']
};
mix.js(
mix.vue(
'test/fixtures/fake-app/resources/assets/vue/app-with-vue-and-global-styles.js',
'js/app.js'
);
Expand Down